package top.mayyd.producteurekaconsumer;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableDiscoveryClient
@EnableCircuitBreaker //开启服务熔断
//@SpringCloudApplication //集成了很多微服务用到的注解
public class ProductEurekaConsumerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ProductEurekaConsumerApplication.class, args);
    }

    //注册一个 RestTemplate bean
    @Bean
    @LoadBalanced //使用 Ribbon 负载均衡
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
